<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function foo(){
            var a = 2;
            return ()=>{
                console.log(a)          // 2 ,说明箭头函数也是一个闭包
                console.log(this)       // person, 说明箭头函数会绑定在定义时候的this上
            }
        }

        var person = {
            a:3,
            foo
        }
        var a = 4;
        var baz = person.foo();        // 2 ,说明箭头函数也是一个闭包
        baz();
        function bar(){
            return function (){
                console.log(this)
            }
        }

        bar()();    // window,说明不是箭头函数的this是动态的
    </script>
</body>
</html>